
const isObject = v => v !== null && typeof v === 'object'


function reactive (obj) {
  if (!isObject(obj)) return obj
  return new Proxy(obj, {
    get(traget, val, receiver) {
      const res =  Reflect.get(traget, val, receiver)
      return isObject(res) ? reactive(res) : res
    },
    set(traget, val, value, receiver) {
      const res =  Reflect.set(traget, val, value, receiver)
      return isObject(res) ? reactive(res) : res
    },
    deleteProperty(traget, val){
      const ret =  Reflect.get(traget, val)
      return ret
    }
  })
}
